package com.yc.jpyy.mobile.controller;


import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.yc.jpyy.base.bean.RestResponse;
import com.yc.jpyy.base.controller.BaseController;
import com.yc.jpyy.mobile.dao.BizDao;
import com.yc.jpyy.mobile.service.BizService;

@Controller
@RequestMapping(value = "/test")
public class TestController extends BaseController{
	@Autowired
	private BizService bizService;
	
	@Autowired
	private BizDao bizDao;
	
	private static Logger logger = LoggerFactory.getLogger(TestController.class);
	
	@RequestMapping(value = "/testTrasanction", method = RequestMethod.POST, produces = "application/json; charset=utf-8")
	public @ResponseBody String getLearnTime(HttpServletRequest request){
		logger.info("=================测试开始=======================");
		RestResponse response = new RestResponse();
		try {
			//int i = bizService.updateUserInfo(4);
			Map<String,Object> map = new HashMap<>();
			map.put("ID", 10000);
			map.put("item", 10000);
			map.put("time", "2018-09-09 00:00:00");
			map.put("an", 0);
			int i = bizService.InsertInfo(map);
			 System.out.println(i);
			/*if(i > 0){
			    int j = 5 / 0;
			    System.out.println(j);
			}*/
		} catch (Exception e) {
			logger.info("cxxxxxxxxxxxxxx---------:"+ e.toString());
		}finally{
			logger.info("===============测试结束=======================");	
		}
		return response.toJSON();
	}

}
